home *** CD-ROM | disk | FTP | other *** search
- ;; Eulisp Module
- ;; Author: pab
- ;; File: sstrm.em
- ;; Date: Fri Jun 11 01:23:50 1993
- ;;
- ;; Project:
- ;; Description:
- ;;
-
- (defmodule sstrm
- (streams1
- telos1
- extras0
- macros0
- defs
- error0 ;; debugging..
- (except (flush close open print generic-prin prin format) init)
- )
- ()
-
- (setq stdout (open "/dev/tty" 'output t))
-
- (defstruct string-stream ()
- ((content initform nil accessor string-stream-content)
- (size initform 0 accessor string-stream-size))
- constructor make-string-stream)
-
- (defmethod generic-output ((x string-stream) s)
- (let ((s (if (stringp s) (copy s)
- (convert s string))))
- (format stdout "Out: '~a'~%" s)
- ((setter string-stream-content) x
- (cons s (string-stream-content x)))
- ((setter string-stream-size) x
- (+ (string-stream-size x) (length s)))
- s))
-
- ;; should be clever and use length field...
- ;; unfortunately, I dont have string-subrange-copy.
-
- (defmethod (converter string) ((x string-stream))
- (fold (lambda (sub str)
- (string-append sub str))
- (string-stream-content x)
- ""))
-
-
-
- ;; end module
- )
-